﻿#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
//常用排序算法merge
void MyPrint(int val)
{
	cout << val << "  ";
}
void test01()
{
	vector<int>v1;
	vector<int>v2;
	for (int i = 0; i < 10; i++)
	{
		v1.push_back(i);
		v2.push_back(i + 1);
	}
	//目标容器
	vector<int>v3;
	//提前给目标容器分配空间
	v3.resize(v1.size() + v2.size());
	merge(v1.begin(), v1.end(), v2.begin(), v2.end(), v3.begin());  //要记得扩容
	for_each(v3.begin(), v3.end(), MyPrint);
}
int main()
{
	test01();
}